package com.juli.v2xdemo.tcp.tcp_impl;

import android.content.Context;
import android.util.Log;

//import com.cz.v2xpro20190520.presenter.PresenterManager;
//import com.cz.v2xpro20190520.tcp.protocol.Cmd55AABusinesser;
import com.example.tcpmaster.callback.AbsTcpActionCallBack;
import com.juli.v2xdemo.tcp.protocol.Cmd55AABusinesser;

/**
 * Created by lianxiang on 2017/9/7.
 * 业务指令处理
 */

public class TcpActionCallBack extends AbsTcpActionCallBack {

    Objectcallback callback;
    public TcpActionCallBack(Context context,   final Objectcallback callback) {
        super(context);
       this. callback=callback;
    }

    @Override
    public void onReceive(String s) {
        Log.e("TAG", "====执行了onReceive"+s);
    }


    @Override
    protected void init(Context context) {

    }

    @Override
    public void onReconnect() {

    }

    @Override
    public void onConnectted() {
        callback.onsuccess("成功");
        Log.e("TAG", "===onConnectted==");
        Cmd55AABusinesser.getInstance().listen();
//        PresenterManager.getInstance().getCarStateSettingPresenter().init();

    }

    @Override
    public void onConnectFailed(int code, String message) {
        Log.e("TAG", "===onConnectFailed==");
    }

    @Override
    public void onDisconnect() {
        Log.e("TAG", "===连接断开==");
//        PresenterManager.getInstance().getCzMapPresenter().onTcpDisConnected();
    }

    @Override
    public void onConnecting() {
        Log.e("TAG", "===连接==");
    }


    @Override
    public void onException(Exception e) {
        Log.e("TAG", "===连接断开1==");
    }

    @Override
    public void onRequestTimeOut() {
        Log.e("TAG", "===连接断开2==");
    }


    public interface Objectcallback {
        void onsuccess(String st);

        void onFalia(int code, String errst);

    }

}
